//
//  ForumClickController.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/3/28.
//  Copyright © 2016年 game. All rights reserved.
//

#import "ForumClickController.h"
#import "ForumTableCell.h"
#import "FunSelectController.h"

@interface ForumClickController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic, strong)  UITableView *tableview;

@end

@implementation ForumClickController

-(void)viewWillAppear:(BOOL)animated{
    self.app.myTabBar.tabBar.hidden = YES;
    self.navigationController.navigationBar.hidden = YES;
    StatusBlack;
    
    self.tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStylePlain];
    [self.view addSubview:self.tableview];
    self.tableview.dataSource = self;
    self.tableview.delegate = self;
    [self.tableview registerNib:[UINib nibWithNibName:@"ForumTableCell" bundle:nil] forCellReuseIdentifier:@"cell"];
}

- (IBAction)backClick:(id)sender {
    [self.navigationController popToRootViewControllerAnimated:YES];
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return SCREEN_HEIGHT*0.13;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.frame = [UIScreen mainScreen].bounds;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return self.model.menu.count;;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ForumTableCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.model = self.model.menu[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    ForumTableCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
    FunSelectController *funSelct = [FunSelectController new];

    funSelct.fid = cell.forum_id.integerValue;

  [self.navigationController pushViewController:funSelct animated:YES];
}
@end